.TH "hwconf/hw_r2.h" 3 "Wed Sep 16 2015" "Doxygen" \" -*- nroff -*-
.ad l
.nh
.SH NAME
hwconf/hw_r2.h \- 
.SH SYNOPSIS
.br
.PP
.SS "Macros"

.in +1c
.ti -1c
.RI "#define \fBENABLE_GATE\fP()   palSetPad(GPIOC, 9)"
.br
.ti -1c
.RI "#define \fBDISABLE_GATE\fP()   palClearPad(GPIOC, 9)"
.br
.ti -1c
.RI "#define \fBDCCAL_ON\fP()   palSetPad(GPIOB, 12)"
.br
.ti -1c
.RI "#define \fBDCCAL_OFF\fP()   palClearPad(GPIOB, 12)"
.br
.ti -1c
.RI "#define \fBIS_DRV_FAULT\fP()   (!palReadPad(GPIOC, 12))"
.br
.ti -1c
.RI "#define \fBLED_GREEN_ON\fP()   palSetPad(GPIOB, 6)"
.br
.ti -1c
.RI "#define \fBLED_GREEN_OFF\fP()   palClearPad(GPIOB, 6)"
.br
.ti -1c
.RI "#define \fBLED_RED_ON\fP()   palSetPad(GPIOB, 7)"
.br
.ti -1c
.RI "#define \fBLED_RED_OFF\fP()   palClearPad(GPIOB, 7)"
.br
.ti -1c
.RI "#define \fBHW_ADC_CHANNELS\fP   15"
.br
.ti -1c
.RI "#define \fBHW_ADC_NBR_CONV\fP   5"
.br
.ti -1c
.RI "#define \fBADC_IND_SENS1\fP   2"
.br
.ti -1c
.RI "#define \fBADC_IND_SENS2\fP   1"
.br
.ti -1c
.RI "#define \fBADC_IND_SENS3\fP   0"
.br
.ti -1c
.RI "#define \fBADC_IND_CURR1\fP   3"
.br
.ti -1c
.RI "#define \fBADC_IND_CURR2\fP   4"
.br
.ti -1c
.RI "#define \fBADC_IND_VIN_SENS\fP   12"
.br
.ti -1c
.RI "#define \fBADC_IND_EXT\fP   10"
.br
.ti -1c
.RI "#define \fBADC_IND_TEMP_MOS1\fP   11"
.br
.ti -1c
.RI "#define \fBADC_IND_TEMP_MOS2\fP   8"
.br
.ti -1c
.RI "#define \fBADC_IND_TEMP_MOS3\fP   14"
.br
.ti -1c
.RI "#define \fBADC_IND_TEMP_MOS4\fP   13"
.br
.ti -1c
.RI "#define \fBADC_IND_TEMP_MOS5\fP   7"
.br
.ti -1c
.RI "#define \fBADC_IND_TEMP_MOS6\fP   7"
.br
.ti -1c
.RI "#define \fBADC_IND_TEMP_PCB\fP   6"
.br
.ti -1c
.RI "#define \fBADC_IND_VREFINT\fP   9"
.br
.ti -1c
.RI "#define \fBV_REG\fP   3\&.3"
.br
.ti -1c
.RI "#define \fBVIN_R1\fP   33000\&.0"
.br
.ti -1c
.RI "#define \fBVIN_R2\fP   2200\&.0"
.br
.ti -1c
.RI "#define \fBCURRENT_AMP_GAIN\fP   10\&.0"
.br
.ti -1c
.RI "#define \fBCURRENT_SHUNT_RES\fP   0\&.001"
.br
.ti -1c
.RI "#define \fBGET_INPUT_VOLTAGE\fP()   ((\fBV_REG\fP / 4095\&.0) * (float)\fBADC_Value\fP[\fBADC_IND_VIN_SENS\fP] * ((\fBVIN_R1\fP + \fBVIN_R2\fP) / \fBVIN_R2\fP))"
.br
.ti -1c
.RI "#define \fBNTC_RES\fP(adc_val)   (10000\&.0 / ((4095\&.0 / (float)adc_val) \- 1\&.0))"
.br
.ti -1c
.RI "#define \fBNTC_TEMP\fP(adc_ind)   (1\&.0 / ((logf(\fBNTC_RES\fP(\fBADC_Value\fP[adc_ind]) / 10000\&.0) / 3434\&.0) + (1\&.0 / 298\&.15)) \- 273\&.15)"
.br
.ti -1c
.RI "#define \fBADC_VOLTS\fP(ch)   ((float)\fBADC_Value\fP[ch] / 4096\&.0 * \fBV_REG\fP)"
.br
.ti -1c
.RI "#define \fBCURR1_DOUBLE_SAMPLE\fP   0"
.br
.ti -1c
.RI "#define \fBCURR2_DOUBLE_SAMPLE\fP   0"
.br
.ti -1c
.RI "#define \fBHW_SERVO_NUM\fP   2"
.br
.ti -1c
.RI "#define \fBHW_UART_DEV\fP   UARTD3"
.br
.ti -1c
.RI "#define \fBHW_UART_GPIO_AF\fP   GPIO_AF_USART3"
.br
.ti -1c
.RI "#define \fBHW_UART_TX_PORT\fP   GPIOC"
.br
.ti -1c
.RI "#define \fBHW_UART_TX_PIN\fP   10"
.br
.ti -1c
.RI "#define \fBHW_UART_RX_PORT\fP   GPIOC"
.br
.ti -1c
.RI "#define \fBHW_UART_RX_PIN\fP   11"
.br
.ti -1c
.RI "#define \fBHW_ICU_CHANNEL\fP   ICU_CHANNEL_2"
.br
.ti -1c
.RI "#define \fBHW_ICU_GPIO_AF\fP   GPIO_AF_TIM3"
.br
.ti -1c
.RI "#define \fBHW_ICU_GPIO\fP   GPIOB"
.br
.ti -1c
.RI "#define \fBHW_ICU_PIN\fP   5"
.br
.ti -1c
.RI "#define \fBHW_I2C_DEV\fP   I2CD2"
.br
.ti -1c
.RI "#define \fBHW_I2C_GPIO_AF\fP   GPIO_AF_I2C2"
.br
.ti -1c
.RI "#define \fBHW_I2C_SCL_PORT\fP   GPIOB"
.br
.ti -1c
.RI "#define \fBHW_I2C_SCL_PIN\fP   10"
.br
.ti -1c
.RI "#define \fBHW_I2C_SDA_PORT\fP   GPIOB"
.br
.ti -1c
.RI "#define \fBHW_I2C_SDA_PIN\fP   11"
.br
.ti -1c
.RI "#define \fBHW_HALL_ENC_GPIO1\fP   GPIOC"
.br
.ti -1c
.RI "#define \fBHW_HALL_ENC_PIN1\fP   6"
.br
.ti -1c
.RI "#define \fBHW_HALL_ENC_GPIO2\fP   GPIOC"
.br
.ti -1c
.RI "#define \fBHW_HALL_ENC_PIN2\fP   7"
.br
.ti -1c
.RI "#define \fBHW_HALL_ENC_GPIO3\fP   GPIOC"
.br
.ti -1c
.RI "#define \fBHW_HALL_ENC_PIN3\fP   8"
.br
.ti -1c
.RI "#define \fBHW_ENC_TIM\fP   TIM3"
.br
.ti -1c
.RI "#define \fBHW_ENC_TIM_AF\fP   GPIO_AF_TIM3"
.br
.ti -1c
.RI "#define \fBHW_ENC_TIM_CLK_EN\fP()   RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE)"
.br
.ti -1c
.RI "#define \fBHW_ENC_EXTI_PORTSRC\fP   EXTI_PortSourceGPIOC"
.br
.ti -1c
.RI "#define \fBHW_ENC_EXTI_PINSRC\fP   EXTI_PinSource8"
.br
.ti -1c
.RI "#define \fBHW_ENC_EXTI_CH\fP   EXTI9_5_IRQn"
.br
.ti -1c
.RI "#define \fBHW_ENC_EXTI_LINE\fP   EXTI_Line8"
.br
.ti -1c
.RI "#define \fBHW_ENC_EXTI_ISR_VEC\fP   EXTI9_5_IRQHandler"
.br
.ti -1c
.RI "#define \fBNRF_PORT_CSN\fP   \fBHW_ICU_GPIO\fP"
.br
.ti -1c
.RI "#define \fBNRF_PIN_CSN\fP   \fBHW_ICU_PIN\fP"
.br
.ti -1c
.RI "#define \fBNRF_PORT_SCK\fP   GPIOC"
.br
.ti -1c
.RI "#define \fBNRF_PIN_SCK\fP   5"
.br
.ti -1c
.RI "#define \fBNRF_PORT_MOSI\fP   \fBHW_I2C_SDA_PORT\fP"
.br
.ti -1c
.RI "#define \fBNRF_PIN_MOSI\fP   \fBHW_I2C_SDA_PIN\fP"
.br
.ti -1c
.RI "#define \fBNRF_PORT_MISO\fP   \fBHW_I2C_SCL_PORT\fP"
.br
.ti -1c
.RI "#define \fBNRF_PIN_MISO\fP   \fBHW_I2C_SCL_PIN\fP"
.br
.ti -1c
.RI "#define \fBADC_V_L1\fP   \fBADC_Value\fP[\fBADC_IND_SENS1\fP]"
.br
.ti -1c
.RI "#define \fBADC_V_L2\fP   \fBADC_Value\fP[\fBADC_IND_SENS2\fP]"
.br
.ti -1c
.RI "#define \fBADC_V_L3\fP   \fBADC_Value\fP[\fBADC_IND_SENS3\fP]"
.br
.ti -1c
.RI "#define \fBADC_V_ZERO\fP   (\fBADC_Value\fP[\fBADC_IND_VIN_SENS\fP] / 2)"
.br
.ti -1c
.RI "#define \fBREAD_HALL1\fP()   palReadPad(\fBHW_HALL_ENC_GPIO1\fP, \fBHW_HALL_ENC_PIN1\fP)"
.br
.ti -1c
.RI "#define \fBREAD_HALL2\fP()   palReadPad(\fBHW_HALL_ENC_GPIO2\fP, \fBHW_HALL_ENC_PIN2\fP)"
.br
.ti -1c
.RI "#define \fBREAD_HALL3\fP()   palReadPad(\fBHW_HALL_ENC_GPIO3\fP, \fBHW_HALL_ENC_PIN3\fP)"
.br
.in -1c
.SH "Macro Definition Documentation"
.PP 
.SS "#define ADC_IND_CURR1   3"

.SS "#define ADC_IND_CURR2   4"

.SS "#define ADC_IND_EXT   10"

.SS "#define ADC_IND_SENS1   2"

.SS "#define ADC_IND_SENS2   1"

.SS "#define ADC_IND_SENS3   0"

.SS "#define ADC_IND_TEMP_MOS1   11"

.SS "#define ADC_IND_TEMP_MOS2   8"

.SS "#define ADC_IND_TEMP_MOS3   14"

.SS "#define ADC_IND_TEMP_MOS4   13"

.SS "#define ADC_IND_TEMP_MOS5   7"

.SS "#define ADC_IND_TEMP_MOS6   7"

.SS "#define ADC_IND_TEMP_PCB   6"

.SS "#define ADC_IND_VIN_SENS   12"

.SS "#define ADC_IND_VREFINT   9"

.SS "#define ADC_V_L1   \fBADC_Value\fP[\fBADC_IND_SENS1\fP]"

.SS "#define ADC_V_L2   \fBADC_Value\fP[\fBADC_IND_SENS2\fP]"

.SS "#define ADC_V_L3   \fBADC_Value\fP[\fBADC_IND_SENS3\fP]"

.SS "#define ADC_V_ZERO   (\fBADC_Value\fP[\fBADC_IND_VIN_SENS\fP] / 2)"

.SS "#define ADC_VOLTS(ch)   ((float)\fBADC_Value\fP[ch] / 4096\&.0 * \fBV_REG\fP)"

.SS "#define CURR1_DOUBLE_SAMPLE   0"

.SS "#define CURR2_DOUBLE_SAMPLE   0"

.SS "#define CURRENT_AMP_GAIN   10\&.0"

.SS "#define CURRENT_SHUNT_RES   0\&.001"

.SS "#define DCCAL_OFF()   palClearPad(GPIOB, 12)"

.SS "#define DCCAL_ON()   palSetPad(GPIOB, 12)"

.SS "#define DISABLE_GATE()   palClearPad(GPIOC, 9)"

.SS "#define ENABLE_GATE()   palSetPad(GPIOC, 9)"

.SS "#define GET_INPUT_VOLTAGE()   ((\fBV_REG\fP / 4095\&.0) * (float)\fBADC_Value\fP[\fBADC_IND_VIN_SENS\fP] * ((\fBVIN_R1\fP + \fBVIN_R2\fP) / \fBVIN_R2\fP))"

.SS "#define HW_ADC_CHANNELS   15"

.SS "#define HW_ADC_NBR_CONV   5"

.SS "#define HW_ENC_EXTI_CH   EXTI9_5_IRQn"

.SS "#define HW_ENC_EXTI_ISR_VEC   EXTI9_5_IRQHandler"

.SS "#define HW_ENC_EXTI_LINE   EXTI_Line8"

.SS "#define HW_ENC_EXTI_PINSRC   EXTI_PinSource8"

.SS "#define HW_ENC_EXTI_PORTSRC   EXTI_PortSourceGPIOC"

.SS "#define HW_ENC_TIM   TIM3"

.SS "#define HW_ENC_TIM_AF   GPIO_AF_TIM3"

.SS "#define HW_ENC_TIM_CLK_EN()   RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE)"

.SS "#define HW_HALL_ENC_GPIO1   GPIOC"

.SS "#define HW_HALL_ENC_GPIO2   GPIOC"

.SS "#define HW_HALL_ENC_GPIO3   GPIOC"

.SS "#define HW_HALL_ENC_PIN1   6"

.SS "#define HW_HALL_ENC_PIN2   7"

.SS "#define HW_HALL_ENC_PIN3   8"

.SS "#define HW_I2C_DEV   I2CD2"

.SS "#define HW_I2C_GPIO_AF   GPIO_AF_I2C2"

.SS "#define HW_I2C_SCL_PIN   10"

.SS "#define HW_I2C_SCL_PORT   GPIOB"

.SS "#define HW_I2C_SDA_PIN   11"

.SS "#define HW_I2C_SDA_PORT   GPIOB"

.SS "#define HW_ICU_CHANNEL   ICU_CHANNEL_2"

.SS "#define HW_ICU_GPIO   GPIOB"

.SS "#define HW_ICU_GPIO_AF   GPIO_AF_TIM3"

.SS "#define HW_ICU_PIN   5"

.SS "#define HW_SERVO_NUM   2"

.SS "#define HW_UART_DEV   UARTD3"

.SS "#define HW_UART_GPIO_AF   GPIO_AF_USART3"

.SS "#define HW_UART_RX_PIN   11"

.SS "#define HW_UART_RX_PORT   GPIOC"

.SS "#define HW_UART_TX_PIN   10"

.SS "#define HW_UART_TX_PORT   GPIOC"

.SS "#define IS_DRV_FAULT()   (!palReadPad(GPIOC, 12))"

.SS "#define LED_GREEN_OFF()   palClearPad(GPIOB, 6)"

.SS "#define LED_GREEN_ON()   palSetPad(GPIOB, 6)"

.SS "#define LED_RED_OFF()   palClearPad(GPIOB, 7)"

.SS "#define LED_RED_ON()   palSetPad(GPIOB, 7)"

.SS "#define NRF_PIN_CSN   \fBHW_ICU_PIN\fP"

.SS "#define NRF_PIN_MISO   \fBHW_I2C_SCL_PIN\fP"

.SS "#define NRF_PIN_MOSI   \fBHW_I2C_SDA_PIN\fP"

.SS "#define NRF_PIN_SCK   5"

.SS "#define NRF_PORT_CSN   \fBHW_ICU_GPIO\fP"

.SS "#define NRF_PORT_MISO   \fBHW_I2C_SCL_PORT\fP"

.SS "#define NRF_PORT_MOSI   \fBHW_I2C_SDA_PORT\fP"

.SS "#define NRF_PORT_SCK   GPIOC"

.SS "#define NTC_RES(adc_val)   (10000\&.0 / ((4095\&.0 / (float)adc_val) \- 1\&.0))"

.SS "#define NTC_TEMP(adc_ind)   (1\&.0 / ((logf(\fBNTC_RES\fP(\fBADC_Value\fP[adc_ind]) / 10000\&.0) / 3434\&.0) + (1\&.0 / 298\&.15)) \- 273\&.15)"

.SS "#define READ_HALL1()   palReadPad(\fBHW_HALL_ENC_GPIO1\fP, \fBHW_HALL_ENC_PIN1\fP)"

.SS "#define READ_HALL2()   palReadPad(\fBHW_HALL_ENC_GPIO2\fP, \fBHW_HALL_ENC_PIN2\fP)"

.SS "#define READ_HALL3()   palReadPad(\fBHW_HALL_ENC_GPIO3\fP, \fBHW_HALL_ENC_PIN3\fP)"

.SS "#define V_REG   3\&.3"

.SS "#define VIN_R1   33000\&.0"

.SS "#define VIN_R2   2200\&.0"

.SH "Author"
.PP 
Generated automatically by Doxygen from the source code\&.
